local skel = fk.CreateSkill {
  name = "efengqi__juejing",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["efengqi__juejing"] = "绝境",
  [":efengqi__juejing"] = "锁定技，你进入或脱离残躯状态时，摸一张牌。你的装备区内的牌带有《残躯：手牌上限+1》。",

  ["$efengqi__juejing1"] = "绝望中，仍存有一线生机！",
  ["$efengqi__juejing2"] = "还不可以认输！",
}

skel:addEffect(fk.HpChanged, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and (player.hp == 1 or (player.hp - data.num) == 1)
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(1, skel.name)
  end,
})

skel:addEffect("maxcards", {
  correct_func = function (self, player)
    if player:hasSkill(skel.name) and player.hp == 1 then
      return #player:getCardIds("e")
    end
  end,
})

return skel
